﻿namespace Borg.Framework
{
    internal class RegisterComboBoxBinder
    {
        private readonly System.Windows.Forms.ComboBox _box;
        private readonly SlotInfo _slot;

        public RegisterComboBoxBinder(SlotInfo slot, System.Windows.Forms.ComboBox box)
        {
            _slot = slot;
            _box = box;
        }

        private void Bind()
        {
            BindData();
        }

        private void BindData()
        {
            IDataModel<ExtensionTypeInfo> model = new RegistredExtensionsDataModel(_slot);
            _box.DataSource = new DataSourceAdapter<ExtensionTypeInfo>(model);
        }

        public static void BindSlotToBox(SlotInfo slot, System.Windows.Forms.ComboBox box)
        {
            new RegisterComboBoxBinder(slot, box).Bind();
        }
    }
}

